const express = require("express");
const fs = require("fs");
const bodyParser = require("body-parser");
const path = require("path");
const cors = require("cors");
const app = express();


app.use(cors()); // 允许跨域请求
app.use(bodyParser.json({ limit: '2048mb', extended: true }));
app.use(express.json()); // 解析 JSON 请求体

// 检查已上传的分片
app.get(`/test/:index`, (req, res) => {
    if (req.params.index == 12) {
        setTimeout(() => {
            res.json({
                code: 200,
                msg: req.params.index
            });
        }, 6000);
    } else {
        res.json({
            code: 200,
            msg: req.params.index
        });
    }


});


app.listen(5001, () => {
    console.log("服务器已启动：http://localhost:5001");
});